package org.jeecg.enums.car;

/**
 * 车场进出记录 入场类型(0正常，1过期转临停,2车位占用转临停)
 *
 */
public enum CarEntryTypeEnum {
    CAR_ENTRY_TYPE_0(0, "正常"),
    CAR_ENTRY_TYPE_1(1, "过期转临停"),
    CAR_ENTRY_TYPE_2(2, "车位占用转临停"),
    ;
    private Integer code;
    private String desc;

    CarEntryTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }


    public static String getDesc(Integer value) {
        if (value == null) return "";
        CarEntryTypeEnum[] enums = values();
        for (CarEntryTypeEnum typeEnum : enums) {
            if (value.intValue()  == typeEnum.getCode().intValue()) {
                return typeEnum.desc;
            }
        }
        return "";
    }

    public static Integer getValue(String desc) {
        CarEntryTypeEnum[] enums = values();
        for (CarEntryTypeEnum typeEnum : enums) {
            if (typeEnum.getDesc().equals(desc)) {
                return typeEnum.code;
            }
        }
        return null;
    }

}
